/**
 * Created by 玮 on 2016/7/9.
 */
//商品罗列封装
var productList=function(len,containbox){
    var allhtml='';
    var html="<div class='floor-box-item'>"+
        "<img src='../img/index/img.png' alt=''/>"+
        "<div class='item-text'>"+
        "<span>红玫瑰花鲜花速递礼盒</span>"+
        "<span>已售<span>78125</span>件</span>"+
        "</div>"+
        "<div class='item-price'>"+
        "<div>￥39</div>"+
        "<div>"+
        "<span>立省39元</span> <br/>"+
        "￥198"+
        "</div>"+
        "<div><button>加入购物车</button></div>"+
        "</div>"+
        "</div>";
    for(var i=0;i<len;i++){
        allhtml+=html;
    }
    containbox.append(allhtml)
};

$(function(){
    $('.toggle-list').click(function(){
        $('table').slideToggle();
        $('.toggle-list').toggleClass('zhankai');
        if($('.toggle-list').hasClass('zhankai')){
            $('.toggle-list button').html('展开');
        }else{
            $('.toggle-list button').html('收起^');
        }
    });
    productList(20,$('.floor-box'))

});